import type { BookType, Nationality } from './constant';

export interface ResponseData<T = any> {
  flag: boolean;
  msg: string;
  data: T;
}
export interface ResultData<T = any> {
  code: string;
  msg: string;
  data: T;
  error: string;
}
export interface avatarResponseData {
  flag: boolean;
  msg?: string;
  data?: string; // 根据实际情况调整 data 的类型
}
export interface PageData {
  total: number;
  list: Book[];
  pageNum: number;
  pageSize: number;
  size: number;
}
export interface Book {
  owner: number;
  id?: number;
  book_code: string;
  name: string;
  author_nationality: Nationality;
  applicable_scope: string;
  isbn: string;
  number: number;
  book_image: string;
  price: number;
  type?: BookType;
  notes: string;
  description: string;
}

export interface Users {
  newPasswd: string;
  oldPasswd: string;
  account_number: string;
  bio: string;
  id: number;
  username: string;
  realname: string;
  email: string;
  password: string;
  college: string;
  major: string;
  sex: string;
  phonenumber: string;
  qqnumber: string;
  role: string;
  avatar: string;
}

export interface UsersPageData {
  total: number;
  list: Users[];
  pageNum: number;
  pageSize: number;
  size: number;
}
export interface Transaction {
  buyer_name: string;
  seller_name: string;
  comment_id: number;
  book_name: string;
  id?: number;
  buyerId: number;
  sellerId: number;
  transaction_date: string;
  amount: number;
  booksId: number;
  quantity: number;
  book_img: string;
  hasCommented: boolean;
}

export interface TransactionForm {
  id?: number;
  buyer_id: number;
  buyer_name: string;
  buyer_college: string;
  buyer_major: string;
  seller_id: number;
  seller_name: string;
  seller_college: string;
  seller_major: string;
  transaction_date: string;
  amount: number;
  books_id: number;
  quantity: number;
  books_name: string;
  book_code: string;
}
export interface TransactionForm1 {
  transaction1: Transaction[];
}
// export confir defaultTransactionForm {
//   id?: number;
//   buyer_id: number;
//   buyer_name: string;
//   buyer_college: string;
//   buyer_major: string;
//   seller_id: number;
//   seller_name: string;
//   seller_college: string;
//   seller_major: string;
//   transaction_date: string;
//   amount: number;
//   books_id: number;
//   quantity: number;
//   books_name: string;
//   book_code: string;
// }

export interface OrderPageData {
  total: number;
  list: Transaction[];
  pageNum: number;
  pageSize: number;
  size: number;
}

export interface Comment {
  reviewer: number;
  imgList: string;
  id: number;
  hasRecommented: boolean;
  order_id: number;
  book_img: string;
  book_name: string;
  transaction_date: string;
  rate: number;
  content: string;
  fileList: {
    raw: any;
    name: string;
    url: string;
  }[];
}
export interface CommentPageData {
  total: number;
  list: Comment[];
  pageNum: number;
  pageSize: number;
  size: number;
}
export interface hascomment {
  id: number;
  hasCommented: boolean;
}
export interface recomment {
  id?: number;
  order_id: number;
  book_img: string;
  book_name: string;
  transaction_date: string;
  rate: number;
  content: string;
  comment_time: string;
  img_list: string;
  comment_id: number;
}

export interface login {
  username: string;
  password: string;
}
export interface register {
  code: string;
  username: string;
  password: string;
  confirmPass: string;
  email: string;
}
